﻿using System;
using System.Web;
using System.Collections;
using System.Web.Caching;

namespace YWTSSys.Library
{    
    /// <summary> 
    /// CacheItemExpiredCallback委托的参数类
    /// </summary>   
    public class CacheItemArgs
    {

        #region 
        private string _CacheKey;
        private int _CacheTimeOut;
        private ArrayList _ParamList;
        private string _ProcedureName;

        #endregion

        #region 构造函数
      
        public CacheItemArgs(string key)
        {
            _CacheKey = key;
            _CacheTimeOut = 20;            
            _ParamList = new ArrayList();
        }

        public CacheItemArgs(string key, int timeout): this(key)
        {
            _CacheTimeOut = timeout;            
            _ParamList = new ArrayList();
        }      

        public CacheItemArgs(string key, int timeout,  params object[] @params) : this(key)
        {
            _CacheTimeOut = timeout;          
            _ParamList = new ArrayList();
            foreach (object obj in @params)
            {
                _ParamList.Add(obj);
            }
        }

        #endregion

        #region 属性       
        
       
        /// <summary> 
        ///缓存键值
        /// </summary>        
        public string CacheKey
        {
            get { return _CacheKey; }
        }
       
        /// <summary> 
        ///超时分钟
        /// </summary> 
        /// <history>       
        public int CacheTimeOut
        {
            get { return _CacheTimeOut; }
            set { _CacheTimeOut = value; }
        }

        
        /// <summary> 
        /// 缓存过期后回调函数的参数列表
        /// </summary> 
        public ArrayList ParamList
        {
            get { return _ParamList; }
        }

        /// <summary> 
        /// 缓存过期后回调函数的参数列表
        /// </summary> 
        public object[] Params
        {
            get { return ParamList.ToArray(); }
        }
        /// <summary>
        /// 缓存过期后回调函数的可使用的存储过程名称
        /// </summary>
        public string ProcedureName
        {
            get { return _ProcedureName; }
            set { _ProcedureName = value; }
        }

        #endregion

    }
}